package br.org.etec.dotcao.model;

import java.util.List;

import br.org.etec.dotcao.dao.DaoFactory;

public class RepositoryImpl<T> implements Repository<T>{

	protected Class<T> type;
	protected Repository<T> delegate;
	
	public RepositoryImpl(Class<T> type) {
		super();
		this.type = type;
		delegate = DaoFactory.get(type);
	}

	@Override
	public void insert(T element) {
		delegate.insert(element);
	}

	@Override
	public void update(T element) {
		delegate.update(element);
	}

	@Override
	public void delete(T element) {
		delegate.delete(element);
	}

	@Override
	public T get(Long code) {
		return delegate.get(code);
	}

	@Override
	public List<T> all() {
		return delegate.all();
	}
	
	@Override
	public void close() {
		delegate.close();
	}
}
